package org.test.client.ui.skinui.popup;

import org.jb2011.ninepatch4j.NinePatch;
import org.test.client.ui.skinui.NinePatchHelper;
import org.test.client.ui.skinui.RawCache;

public class PopupIconFactory extends RawCache<NinePatch>{
	
	/** 相对路径根（默认是相对于本类的相对物理路径）. */
	public final static String IMGS_ROOT="res";

	/** The instance. */
	private static PopupIconFactory instance = null;

	/**
	 * Gets the single instance of __Icon9Factory__.
	 *
	 * @return single instance of __Icon9Factory__
	 */
	public static PopupIconFactory getInstance()
	{
		if(instance==null)
			instance = new PopupIconFactory();
		return instance;
	}
	
	/* (non-Javadoc)
	 * @see org.jb2011.lnf.beautyeye.utils.RawCache#getResource(java.lang.String, java.lang.Class)
	 */
	@Override
	protected NinePatch getResource(String relativePath, Class baseClass)
	{
		return NinePatchHelper.createNinePatch(baseClass.getResource(relativePath), false);
	}

	/**
	 * Gets the raw.
	 *
	 * @param relativePath the relative path
	 * @return the raw
	 */
	public NinePatch getRaw(String relativePath)
	{
		return  getRaw(relativePath,this.getClass());
	}

	
	/**
	 * Gets the popup bg.
	 *
	 * @return the popup bg
	 */
	public NinePatch getPopupBg()
	{
		return getRaw(IMGS_ROOT+"/shadow_bg_popup.9.png");
	}
	
	/**
	 * Gets the tooltip bg.
	 *
	 * @return the tooltip bg
	 */
	public NinePatch getTooltipBg()
	{
		return getRaw(IMGS_ROOT+"/shadow_bg_tooltip2.9.png");
	}
}
